package com.zbw.common.controller.Feign;


import com.zbw.common.entity.User;
import com.zbw.common.entity.UserBuyRecord;
import com.zbw.common.vo.UserDetails;
import io.github.xxyopen.model.resp.RestResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient("novel-user")
@Component
public interface UserFeign {

    @RequestMapping("user/login")
    UserDetails login(@RequestBody User user);

    @RequestMapping("user/register")
    UserDetails register(@RequestBody User user);

    @RequestMapping("user/queryIsInShelf")
    Boolean queryIsInShelf(@RequestParam("userId")Long userId,@RequestParam("bookId") Long bookId);

    @RequestMapping("user/addToBookShelf")
    void addToBookShelf
            (@RequestParam("userId")Long userId,@RequestParam("bookId") Long bookId,@RequestParam("preContentId") Long preContentId);

    @RequestMapping("user/removeFromBookShelf")
    void removeFromBookShelf(@RequestParam("userId")Long userId,@RequestParam("bookId") Long bookId);

    @RequestMapping("user/addReadHistory")
    void addReadHistory(@RequestParam("userId")Long userId,@RequestParam("bookId") Long bookId,@RequestParam("preContentId") Long preContentId);

    @RequestMapping("user/addFeedBack")
    void addFeedBack(@RequestParam("userId")Long userId,@RequestParam("content") String content);

    @RequestMapping("user/userInfo")
    User userInfo(@RequestParam("userId")Long userId);

    @RequestMapping("user/updateUserInfo")
    void updateUserInfo(@RequestParam("userId")Long userId,@RequestBody User user);

    @RequestMapping("user/updatePassword")
    RestResult<?> updatePassword(@RequestParam("userId")Long userId, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword);

    @RequestMapping("user/queryIsBuyBookIndex")
    boolean queryIsBuyBookIndex(@RequestParam("id")Long id,@RequestParam("bookIndexId") Long bookIndexId);

    @RequestMapping("user/buyBookIndex")
    RestResult buyBookIndex(@RequestParam("id")Long id,@RequestBody UserBuyRecord buyRecord);

    @RequestMapping("user/addAmount")
    void addAmount(@RequestParam("userId")Long userId,@RequestParam("totalAmount") int totalAmount);

//    @RequestMapping("user/listBookShelfByPage")
//    PageBean<BookShelfVO> listBookShelfByPage(@RequestParam("userId")Long userId, @RequestParam("page") Integer page, @RequestParam("pagesize") Integer pageSize);


}
